<?php
// 直接读取配置文件
$config_file = __DIR__ . '/../../application/config.php';
if (file_exists($config_file)) {
    $config = include $config_file;
    
    echo "检查 wechatpay.merchant_private_key_path 配置:\n";
    if (isset($config['wechatpay']['merchant_private_key_path'])) {
        $path = $config['wechatpay']['merchant_private_key_path'];
        var_dump($path);
        
        echo "\n文件是否存在:\n";
        if ($path && file_exists($path)) {
            echo "文件存在: " . $path . "\n";
        } else {
            echo "文件不存在或路径为空\n";
            echo "尝试的路径: " . ($path ? $path : 'NULL') . "\n";
        }
    } else {
        echo "配置项 wechatpay.merchant_private_key_path 不存在\n";
    }
    
    echo "\n检查 DOCUMENT_ROOT:\n";
    var_dump($_SERVER['DOCUMENT_ROOT']);
    
    echo "\n完整路径构造测试:\n";
    $test_path = $_SERVER['DOCUMENT_ROOT'] . '/wxcert/apiclient_key.pem';
    echo "构造的路径: " . $test_path . "\n";
    echo "文件存在: " . (file_exists($test_path) ? '是' : '否') . "\n";
} else {
    echo "配置文件不存在\n";
}
?>